
package ui.adapter;

import android.content.Context;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.widget.TextView;

import net.ck.hzq.R;

import java.util.ArrayList;
import java.util.List;

import Utils.StringUtil;
import base.BaseViewHolder;
import base.SuperBaseAdapter;
import cn.finalteam.loadingviewfinal.RecyclerViewFinal;
import ui.model.ReardsGrowthBean;


/**
 * 新钱包奖励适配器
 * Created by chenjian on 19/2/27.
 */
public class RewardsDetailsGrowthTopAdapter extends SuperBaseAdapter<ReardsGrowthBean.RecordsBean> {

    List<ReardsGrowthBean.RecordsBean> mData = new ArrayList<>();
    Context mContext;

    public RewardsDetailsGrowthTopAdapter(Context context, List<ReardsGrowthBean.RecordsBean> data) {
        super(context, data);
        mContext = context;
        mData = data;
    }

    @Override
    protected void convert(BaseViewHolder holder, final ReardsGrowthBean.RecordsBean item, final int position) {
        TextView time = holder.getView(R.id.item_rewards_details_top_time);
        TextView money = holder.getView(R.id.item_rewards_details_top_money);
        time.setText(item.getYear() + "." + item.getMonth());
        money.setText("奖励金额：" + StringUtil.getFormatPrice(item.getAmount()) + "元");
        RecyclerViewFinal rv = holder.getView(R.id.pull_refresh_rv);
        rv.setLayoutManager(new LinearLayoutManager(mContext));
        rv.setItemAnimator(new DefaultItemAnimator());
        RewardsDetailsGrowthAdapter adapter = new RewardsDetailsGrowthAdapter(mContext, item.getList());
        rv.setAdapter(adapter);


    }

    @Override
    protected int getItemViewLayoutId(int position, ReardsGrowthBean.RecordsBean item) {
        return R.layout.item_rewards_growth;
    }

}
